{extend name='common/common' /}

{block name="content"}
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>数据表列表</h5>
            </div>
            <div class="ibox-content">

                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <th>表名</th>
                        <th>记录数</th>
                        <th>上次备份时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {if !empty($tables)}
                    {foreach name="tables" item="vo"}
                        <tr>
                            <td>{$vo[$database_name]}</td>
                            <td>{$vo.alls}</td>
                            <td>{$vo.ctime}</td>
                            <td>{$vo.operate}</td>
                        </tr>
                    {/foreach}
                    {/if}
                    </tbody>
                </table>

            </div>
        </div>
    </div>
</div>
<!-- End Panel Other -->
</div>
<!-- 角色分配 -->
<div class="col-sm-12" style="display: none" id="wait">
    <div class="ibox ">
        <div class="ibox-content">
            <div class="spiner-example">
                <div class="sk-spinner sk-spinner-three-bounce">
                    <div class="sk-bounce1"></div>
                    <div class="sk-bounce2"></div>
                    <div class="sk-bounce3"></div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script type="text/javascript">
function importData(table, all){
    index = layer.open({
        type: 1,
        area:'400px',
        title:'正在操作',
        skin: 'layui-layer-demo', //加上边框
        content: $('#wait')
    });
    $.getJSON("{:url('data/importData')}", {'table' : table}, function(res){
        layer.close(index);
        layer.alert('备份成功！', {icon: 1}, function(){
            window.location.reload();
        });
    })
}

function backData(table){
    index = layer.open({
        type: 1,
        area:'400px',
        title:'正在操作',
        skin: 'layui-layer-demo', //加上边框
        content: $('#wait')
    });
    $.getJSON("{:url('data/backData')}", {'table' : table}, function(res){
        layer.close(index);
        if(res.code == 1){
            layer.alert('还原成功！', {icon: 1}, function(){
                window.location.reload();
            });
        }else{
            layer.alert(res.msg, {icon: 2});
        }
    })
}
</script>
{/block}
